--[[
Lickity -- protection against unwanted licks! ^_^

author: Tabithy
email: tabithy@gmail.com
website: http://www.googlecode.com/p/tabstools
]]

LICKITY_ENABLED = true

Lickity = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceEvent-2.0")

Lickity:RegisterChatCommand({"/lickity"}, {
    type = 'group',
    args = {
        enable = {
            type = 'toggle',
            name = "turn on lick protection",
            desc = "turn on lick protection",
            get=function() return LICKITY_ENABLED end,
            set=function(v) LICKITY_ENABLED = v end  
        }
    }
})

function Lickity:OnEnable()
    self:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
end

function Lickity:CHAT_MSG_TEXT_EMOTE(arg1, arg2)
    if (LICKITY_ENABLED and not (arg2 == "player") 
            and (string.find(arg1, "licks you"))) then
        self:Print("lick detected!")
        self:Print("employing countermeasures!")
        DoEmote("THREATEN", arg2)
    end
end
